'''
Created on 2011. 3. 1.

@author: blueneti
'''
'http://docs.python.org/library/unittest.html'
import random
import unittest


class TestSequenceFunction(unittest.TestCase):


    def setUp(self):
        self.seq = range(10)
        pass


    def tearDown(self):
        pass


    def testName(self):
        pass
    
    def testShuffle(self):
        random.shuffle(self.seq)
        self.seq.sort()
        self.assertEqual(self.seq, range(10))
        self.assertRaises(TypeError, random.shuffle, (1,2,3))
        
    def testChoice(self):
        element = random.choice(self.seq)
        self.assertTrue(element in self.seq)

    def testSample(self):
        with self.assertRaises(ValueError):
            random.sample(self.seq, 20)
        for element in random.sample(self.seq, 5):
            self.assertTrue(element in self.seq)


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()